package kr.hkit.androidcomplete01.ch07;

import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.os.Bundle;
import android.view.View;

public class Primitive2 extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		MyView mv = new MyView(this);
		setContentView(mv);
	}
	
	class MyView extends View{
		Paint pnt = new Paint();
		RectF r;
		
		public MyView(Context context) {
			super(context);
		}
		
		public void onDraw(Canvas canvas){
			canvas.drawARGB(255, 204, 204, 204);
			canvas.drawRGB(204, 204, 204);
			canvas.drawColor(0xffcccccc);
			pnt.setColor(Color.LTGRAY);
			canvas.drawPaint(pnt);
			r = new RectF(10, 10, 100, 100);
			pnt.setColor(Color.RED);
			canvas.drawRoundRect(r, 10, 10, pnt);
			r.set(110, 10, 150, 100);
			canvas.drawOval(r, pnt);
			pnt.setColor(Color.MAGENTA);
			r.set(110, 110, 200, 200);
			canvas.drawArc(r, 10, 150, true, pnt);
			pnt.setColor(Color.BLUE);
			float[] pts = {10, 210, 50, 250, 50, 250, 110, 220};
			canvas.drawLines(pts, pnt);
			pnt.setColor(Color.BLACK);
			float[] pts2 = {20, 210, 50, 240, 100, 220};
			canvas.drawPoints(pts2, pnt);
		}
	}
}
